package cn.dancepeak.mongo.service.impl;

import cn.dancepeak.mongo.Comment;
import cn.dancepeak.mongo.repository.CommentRepository;
import cn.dancepeak.mongo.service.ICommentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImplImpl implements ICommentServiceImpl {
    @Autowired
    private CommentRepository commentRepository;
    @Override
    public void add(Comment comment) {
        commentRepository.save(comment);
    }

    @Override
    public void delete(String id) {
        commentRepository.deleteById(id);
    }

    @Override
    public List<Comment> findByArticleId(Long articleId) {
        return commentRepository.findByArticleId(articleId);
    }

}
